MODBUS2 Communication Driver

 

MODBUS2 communication driver is the driver to communicate with Modicon PLC in U.S.A .

 

1. Read Settings

 

<Figure 1> is MODBUS2 communication driver read setting examples.

 

 <Figure 1> MODBUS2 communication driver read setting examples

 

<Figure 1> is the screen where Com Port(COM1), Com Baud(9600), Parity Bit(0), Data Bit(8), Stop Bit(1) are input in DEVICE part

In protocol option part, you can set the following: whether to check CRC(1 = check, 0 = No check), bit write value that corresponds to ON(Default = 65280), protocol type(1 = IP protocol, 0 = Serial protocol), bit write value that corresponds to OFF(Default = 0), whether to use WORD size(1 = Not using WORD size, 0 = using WORD size, Default = 0), whether to use multi write(0 = Not using multi write, 1 = using multi write, Default = 0), state value storage position for comparison of data(input WORD memory address, Defualt = 1000). Each argument  is a comma-delimited.

 

Note) MODBUS IP protocol is used in systems that are connected by Ethernet(TCP/IP or UDP/IP).

 

 

MODBUS2 communication driver read schedule

Read schedule setting parameters are as follows:

1)     STATION – Input equipment ID between 0 ~ 255

2)     Read Command – Read command.

3 – Reading the data of WORD unit.

3D – Reading the data of DWORD unit ( WORD order : LO, HI ).

3d – Reading the data of DWORD unit ( WORD order : HI, LO ).

3lD, 3LD – Reading the data of 8 BYTE unit ( WORD order : LO, HI ).

3ld, 3Ld – Reading the data of 8 BYTE unit ( WORD order : HI, LO ).

3M – Reading the special data[HI WORD x 10000 + LO WORD] of DWORD unit ( WORD order : LO, HI ).

3m – Reading the special data[HI WORD x 10000 + LO WORD] of DWORD unit ( WORD order : HI, LO ).

3lM, 3LM – Reading the special data[HI WORD x 10000 + LO WORD] of 8 BYTE unit ( WORD order : LO, HI ).

3lm, 3Lm – Reading the special data[HI WORD x 10000 + LO WORD] of 8 BYTE unit ( WORD order : HI, LO ).

3s – Reading the special data[16 BYTE BCD ASCII].

3F – Reading the data of FLOAT unit ( WORD order : LO, HI ).

3F2 – Reading the data of FLOAT unit ( WORD order : LO, HI ).

3f – Reading the data of FLOAT unit ( WORD order : HI, LO ).

3f2 – Reading the data of FLOAT unit ( WORD order : HI, LO ).

3U – Reading the data of DOUBLE unit ( WORD order : LO, HI ).

3u – Reading the data of DOUBLE unit ( WORD order : HI, LO ). 

1X, 2X – Reading the data of BIT unit ( 1xxxx, 2xxxx Modbus address ).

1XB, 2XB – Reading the data of BIT unit ( 1xxxx, 2xxxx Modbus address ).

3B – Reading the data of BYTE unit. 

3)     Read Start Address – Input address of equipment ( Modbus address - 1 )

4)     Save Start Address for Communication Server – Input Memory Start Address which will store the data from equipment.

5)     Read Size – Input the read size of data.

3 –  WORD unit,

3D, 3d, 3M, 3m, 3F, 3F2, 3f, 3f2 – 2 WORD unit,

3LD, 3ld, 3LM, 3lm, 3U, 3u – 4 WORD unit.

3s – 8 WORD unit,

1X, 2X – WORD unit,

1XB, 2XB – BIT unit ( 1 ~ 15 = 1 WORD, 16 ~ 31 = 2 WORD, ¡¦).

3B – BYTE unit.

 

If you click the icon ¼³¸í: ¼³¸í: ¼³¸í: ¼³¸í: ¼³¸í: ¼³¸í: ¼³¸í: ¼³¸í: ¼³¸í: ¼³¸í: ¼³¸í: ¼³¸í: 2 in protocol option part, you can see the dialog box such as <Figure 2>. you can also set read schedule by using this part.

 

<Figure 2> Example of MODBUS2 Communication Driver¡¯s Option dialog box

 

You can set read schedule by using ¼³¸í: ¼³¸í: ¼³¸í: ¼³¸í: ¼³¸í: ¼³¸í: ¼³¸í: ¼³¸í: ¼³¸í: ¼³¸í: ¼³¸í: ¼³¸í: 3, ¼³¸í: ¼³¸í: ¼³¸í: ¼³¸í: ¼³¸í: ¼³¸í: ¼³¸í: ¼³¸í: ¼³¸í: ¼³¸í: ¼³¸í: ¼³¸í: 4, ¼³¸í: ¼³¸í: ¼³¸í: ¼³¸í: ¼³¸í: ¼³¸í: ¼³¸í: ¼³¸í: ¼³¸í: ¼³¸í: ¼³¸í: ¼³¸í: 5 button and listbox of <Figure 2>.

Also, in Modus Protocol Option shown in <Figure 2>, you can set set the following: whether to check CRC(1 = check, 0 = No check), bit write value that corresponds to ON(Default = 65280), protocol type(1 = IP protocol, 0 = Serial protocol), bit write value that corresponds to OFF(Default = 0), whether to use WORD size(1 = Not using WORD size, 0 = using WORD size, Default = 0), whether to use multi write(0 = Not using multi write, 1 = using multi write, Default = 0), state value storage position for comparison of data(input WORD memory address, Defualt = 1000).

 

<Figure 3> Example of MODBUS2 communication driver¡¯s read schedule Add/Edit dialog box

 

 

2. Write settings

 

Digital write

Digital write setting parameters are as follows:

1)  PORT                   Input port number. (0 ~ 255)

2)  STATION             Input equipment ID.

3)  ADDRESS           Input address of equipment ( Modbus address - 1 )

4)  Extra1                 Input bit write command (Modbus fuction code 5)

5)  Extra2                 Don¡¯t care.

 

Analog write

Analog write setting parameters are as follows:

1)  PORT                  Input port number. (0 ~ 255)

2)  STATION            Input equipment ID.

3)  ADDRESS          Input address of equipment ( Modbus address - 1 )

4)  Extra1                Input word write command

16 – Writing the data of WORD unit.

16D – Writing the data of DWORD unit ( WORD order : LO, HI ).

16d – Writing the data of DWORD unit ( WORD order : HI, LO ).

16lD, 16LD – Writing the data of 8 BYTE unit ( WORD order : LO, HI ).

16ld, 16Ld – Writing the data of 8 BYTE unit ( WORD order : LO, HI ).

16M – Writing the special data[HI WORD x 10000 + LO WORD] of DWORD unit ( WORD order : LO, HI ).

16m – Writing the special data[HI WORD x 10000 + LO WORD] of DWORD unit ( WORD order : HI, LO ).

16lM, 16LM – Writing the special data[HI WORD x 10000 + LO WORD] of 8 BYTE unit ( WORD order : LO, HI ).

16lm, 16Lm – Writing the special data[HI WORD x 10000 + LO WORD] of 8 BYTE unit ( WORD order : HI, LO ).

16s – Writing the special data[16 BYTE BCD ASCII].

16F – Writing the data of FLOAT unit ( WORD order : LO, HI ).

16F2 – Writing the data of FLOAT unit ( WORD order : LO, HI ).

16f – Writing the data of FLOAT unit ( WORD order : HI, LO ).

16f2 – Writing the data of FLOAT unit ( WORD order : HI, LO ).

16U – Writing the data of DOUBLE unit ( WORD order : LO, HI ).

16u – Writing the data of DOUBLE unit ( WORD order : HI, LO ). 

16B – Writing the data of BYTE unit.

16H_TIME – transmit the current time of computer to HICM equipment. (You have to write 6 word one by one - year, month, day, hour, minute, second / only word write)

5)  Extra2                  Multi word write / comparison setting

1 = The value for multi word write is stored.  ( Don't care Extar1 part. )

2 = Multi word write is executed. ( The stored quantity is written. )

3 = The value for multi word write is deleted. ( Don't care Extar1 part. )

4 = Compaing the currently stored value to the memory value of the PLC. ( The stored quantity is written )

Other Value( 0 or exceeding 4 ) = Normal(one) word write

 

 

Example 1)

PORT : 0   STATION : 1   ADDRESS : 0100  EXTRA1 : 16  EXTRA2 : 0

 The setting parameter shown above is an example of word write for changing the value of 100 WORD address of Equipment connected with 0 port, set to 1 station.

 

Example 2)

PORT : 0   STATION : 1   ADDRESS : 5000  EXTRA1 : 16d  EXTRA2 : 0

 The setting parameter shown above is an example of word write for changing the value of 5000 DWORD address of Equipment connected with 0 port, set to 1 station.

 

 

Example of script for multi word write)

$AO_0000.Extra2 = 3;                                                // Delete the previously stored value for multi word write.

@SetTagValue("AO_0000", 0);

 

$AO_0000.Extra2 = 1;                                                // Store the new value for multi word write.

for(i = 0; i < 50; i = i + 1) {

   @sprintf($AO_0000.Extra1, "%03d", i);                // Input  a random value in Extra1, not to ignore the same data.

   @SetTagValue("AO_0000", 5000);                       // Store the actual ouput value. Here is set to 5000.

}

@sprintf($AO_0000.Extra1, "16");                          // Set the output data type to WORD unit.

$AO_0000.Extra2 = 2;                                               // Execute multi word write.

@SetTagValue("AO_0000", 1);                               // 50 values is output.

 

 

Example of script for comparing the current value of PLC with the value of memory)

$AO_CHECK_MEM_SET = 2;                                     // To check the comparison, make WORD address set to 2.

for(i = 0; i < 1; ) {

   if($AI_CHECK_WRITE_STATUS == 2) i = 10;       // An output of value 2 is completed.

   @TagCheckLoop();                                                    // A function to check the tag value changes

}

 

$AO_0000.Extra2 = 3;                                                  // Delete the previously stored value for multi word write.

@SetTagValue("AO_0000", 0);

 

$AO_0000.Extra2 = 1;                                                 // Store the new value for multi word write.

for(i = 0; i < 50; i = i + 1) {

   @sprintf($AO_0000.Extra1, "%03d", i);                 // Input  a random value in Extra1, not to ignore the same data.

   @SetTagValue("AO_0000", 5000);                        // Store the value for comparison. Here is set to 5000.

}

@sprintf($AO_0000.Extra1, "16");                           // The data type is set to WORD.

$AO_0000.Extra2 = 4;                                                // Compare the values.

@SetTagValue("AO_0000", 1);                                // 50 values are compared.

 

for(i = 0; i < 1; ) {

   if($AI_CHECK_WRITE_STATUS == 1) i = 10;                  // Result 1 = Identical data

   if($AI_CHECK_WRITE_STATUS == 0) {                            // Result 0 = Different data

      @MessageBox("The two data is identical.", "Data comparison completing", MB_OK);

      return;

   }

   @TagCheckLoop();                                                              // A function to check the tag value changes

}

@MessageBox("The two data is different.", "Data comparison error", MB_OK);

 

 

Note when writing scripts for comparison)

1) The comparison result is stored in preset WORD address. 1 ( Identical data ), 0 ( Different data ).

2) Before comparing the current value of the equipment, input a value other than 1,0 at preset WORD address and confirm the comparison result.

3) AO tag named AO_CHECK_MEM_SET is so set as to output in preset WORD address. ( Extra1 = #MEM# )

4) AI tag named AI_CHECK_WRITE_STATUS is set with WORD address which is preset as PLC_SCAN tag.

 

 

Block write

Block write is set by using the PlcScanWriteBlock function as follows:  

The fuction name and type : @PlcScanWriteBlock(int port, int station, int address, string extra1, string extra2, object array_value, int array_size);

Example of script)

             ushort   writeVal[5];

 

            writeVal[0] = 1;

            writeVal[1] = 2;

            writeVal[2] = 3;

            writeVal[3] = 4;

            writeVal[4] = 5;

            @PlcScanWriteBlock(0, 1, 5, ¡°16¡±, ¡°¡±, writeVal, 5);

 

Extra1, parameter of block write, is set with one of following command. (You can set any fuction other than 16. If the fuction 0, Extra1 is set with 16(10h) as the default.)

16 – Writing the block data of WORD unit.

16D – Writing the block data of DWORD unit ( WORD order : LO, HI ).

16d – Writing the block data of DWORD unit ( WORD order : HI, LO ).

16lD, 16LD – Writing the block data of 8 BYTE unit ( WORD order : LO, HI ).

16ld, 16Ld – Writing the block data of 8 BYTE unit ( WORD order : LO, HI ).

16M – Writing the special block data[HI WORD x 10000 + LO WORD] of DWORD unit ( WORD order : LO, HI ).

16m – Writing the special block data[HI WORD x 10000 + LO WORD] of DWORD unit ( WORD order : HI, LO ).

16lM, 16LM – Writing the special block data[HI WORD x 10000 + LO WORD] of 8 BYTE unit ( WORD order : LO, HI ).

16lm, 16Lm – Writing the special block data[HI WORD x 10000 + LO WORD] of 8 BYTE unit ( WORD order : HI, LO ).

16F – Writing the block data of FLOAT unit ( WORD order : LO, HI ).

16F2 – Writing the block data of FLOAT unit ( WORD order : LO, HI ).

16f – Writing the block data of FLOAT unit ( WORD order : HI, LO ).

16f2 – Writing the block data of FLOAT unit ( WORD order : HI, LO ).

16B – Writing the block data of BYTE unit.

 

Important) Block write is supported in SCADA Server 10.1.4.3 or higher version. You can output data up to 250 at once.

 

[Reference] Equipment which use MODBUS2 Communication Driver

JoongAng Control CO., LTD - NV4016A